<?php

class Rekap_jumlah_pns extends Controller {

    function Rekap_jumlah_pns() {
        parent::Controller();
        $this->load->model('R_jumlah_pns_mod', 'p');
    }
    
    function index() {
        redirect("/welcome", "refresh");
    }
    function _setJsPaging($isi, $nama_variabel, $tabel_header) {
        $ret = '
        <script type="text/javascript">
            '.$isi.'

            // This file demonstrates the different options of the pagination plugin
            // It also demonstrates how to use a JavaScript data structure to
            // generate the paginated content and how to display more than one
            // item per page with items_per_page.

            /**
             * Callback function that displays the content.
             *
             * Gets called every time the user clicks on a pagination link.
             *
             * @param {int}page_index New Page index
             * @param {jQuery} jq the container with the pagination links as a jQuery object
             */
            function pageselectCallback(page_index, jq){
                // Get number of elements per pagionation page from form
                var items_per_page = 15;
                var max_elem = Math.min((page_index+1) * items_per_page, '.$nama_variabel.'.length);
                var newcontent = \''.$tabel_header.'\';

                // Iterate through a selection of the content and build an HTML string
                for(var i=page_index*items_per_page;i<max_elem;i++)
                {
                    newcontent += '.$nama_variabel.'[i];
                }

                newcontent += \'</tbody></table>\';

                // Replace old content with new content
                $("#isi_tabel").html(newcontent);

                // Prevent click eventpropagation
                return false;
            }

            // When document has loaded, initialize pagination and form
            $(document).ready(function(){
                $("#paginasi").pagination('.$nama_variabel.'.length, {
                    items_per_page:'.ROW_PER_PAGE.',
                    num_edge_entries: '.NUM_EDGE_ENTRIES.',
                    next_text: \''.TEKS_NEXT.'\',
                    prev_text: \''.TEKS_PREV.'\',
                    next_show_always: '.ALWAYS_SHOW_NEXT.',
                    prev_show_always: '.ALWAYS_SHOW_PREV.',
                    callback:pageselectCallback
                });
            });
        </script>
        ';
        return $ret;
    }
    
    function jkagd($print_mode=false) {
        if (!$this->session->userdata('username')) {
            $data['isLogin'] = FALSE;
            redirect("/login", "location");
        } else {
            $data['isLogin'] = TRUE;
            $data['username'] = $this->session->userdata('username');
            $data['role'] = $this->session->userdata('role');
        }
        if ($print_mode) {
            $tabel_header = $this->p->list_jumlah_header(true);
            $content      = $this->p->list_jumlah_isi(true);
            $data['list_data'] = $tabel_header.$content;
            $data['judul'] = 'REKAPITULASI JUMLAH PEGAWAI NEGERI SIPIL BERDASARKAN JENIS KELAMIN, AGAMA DAN GOLONGAN DARAH'.br().'BULAN '.strtoupper( getBulan(date('n')) ).' '.date('Y');
            $this->load->view('view_print_report', $data);
        } else { 
            
            $tabel_header = $this->p->list_jumlah_header();
            $nama_variabel = 'data';
            $isi = 'var '.$nama_variabel.'='.$this->p->list_jumlah_isi($print_mode);
            $data['judul'] = 'REKAPITULASI JUMLAH PEGAWAI NEGERI SIPIL BERDASARKAN JENIS KELAMIN, AGAMA DAN GOLONGAN DARAH'.br().'BULAN '.strtoupper( getBulan(date('n')) ).' '.date('Y');
          
            $data['additional_js'] = $this->_setJsPaging($isi, $nama_variabel, $tabel_header);
            
            
            $data['link_cetak'] = base_url().'index.php/rekap_jumlah_pns/jkagd/true/';
            $data['tampilkan_menu'] = true;

        $this->load->view('v_rekap',$data);
        }
    }

    
    function pendik($print_mode=false) {
        if (!$this->session->userdata('username')) {
            $data['isLogin'] = FALSE;
            redirect("/login", "location");
        } else {
            $data['isLogin'] = TRUE;
            $data['username'] = $this->session->userdata('username');
            $data['role'] = $this->session->userdata('role');
        }
        
        if ($print_mode) {
            $tabel_header = $this->p->pendik_header(true);
            $content      = $this->p->pendik_isi(true);
            $data['list_data'] = $tabel_header.$content;
            $data['judul'] = 'REKAPITULASI JUMLAH PEGAWAI NEGERI SIPIL BERDASARKAN PENDIDIKAN FORMAL DAN DIKLAT STRUKTURAL' .br().'BULAN '.strtoupper( getBulan(date('n')) ).' '.date('Y');
            $this->load->view('view_print_report', $data);
        } else { 
            
            $tabel_header = $this->p->pendik_header();
            $nama_variabel = 'data';
            $isi = 'var '.$nama_variabel.'='.$this->p->pendik_isi($print_mode);
            $data['judul'] = 'REKAPITULASI JUMLAH PEGAWAI NEGERI SIPIL BERDASARKAN PENDIDIKAN FORMAL DAN DIKLAT STRUKTURAL' .br().'BULAN '.strtoupper( getBulan(date('n')) ).' '.date('Y');
          
            $data['additional_js'] = $this->_setJsPaging($isi, $nama_variabel, $tabel_header);
            
            
            $data['link_cetak'] = base_url().'index.php/rekap_jumlah_pns/pendik/true/';
            $data['tampilkan_menu'] = true;

            $this->load->view('v_rekap',$data);
        }
    }
    
    
    function gol_ruang($print_mode=false) {
        if (!$this->session->userdata('username')) {
            $data['isLogin'] = FALSE;
            redirect("/login", "location");
        } else {
            $data['isLogin'] = TRUE;
            $data['username'] = $this->session->userdata('username');
            $data['role'] = $this->session->userdata('role');
        }
            
            if ($print_mode) {
            $tabel_header = $this->p->gol_header(true);
            $content      = $this->p->gol_isi(true);
            $data['list_data'] = $tabel_header.$content;
            $data['judul'] = 'REKAPITULASI JUMLAH PEGAWAI NEGERI SIPIL BERDASARKAN GOLONGAN RUANG' .br().'BULAN '.strtoupper( getBulan(date('n')) ).' '.date('Y');
            $this->load->view('view_print_report', $data);
        } else { 
            
            $tabel_header = $this->p->gol_header();
            $nama_variabel = 'data';
            $isi = 'var '.$nama_variabel.'='.$this->p->gol_isi($print_mode);
            $data['judul'] = 'REKAPITULASI JUMLAH PEGAWAI NEGERI SIPIL BERDASARKAN GOLONGAN RUANG' .br().'BULAN '.strtoupper( getBulan(date('n')) ).' '.date('Y');
          
            $data['additional_js'] = $this->_setJsPaging($isi, $nama_variabel, $tabel_header);
            
            
            $data['link_cetak'] = base_url().'index.php/rekap_jumlah_pns/gol_ruang/true/';
            $data['tampilkan_menu'] = true;

            $this->load->view('v_rekap',$data);
        }


    }
    
    
    
    function umur($print_mode=false) {
        if (!$this->session->userdata('username')) {
            $data['isLogin'] = FALSE;
            redirect("/login", "location");
        } else {
            $data['isLogin'] = TRUE;
            $data['username'] = $this->session->userdata('username');
            $data['role'] = $this->session->userdata('role');
        }
        if ($print_mode) {
            $tabel_header = $this->p->umur_header(true);
            $content      = $this->p->umur_isi(true);
            $data['list_data'] = $tabel_header.$content;
            $data['judul'] = 'REKAPITULASI JUMLAH PEGAWAI NEGERI SIPIL BERDASARKAN KELOMPOK UMUR'.br().'BULAN '.strtoupper( getBulan(date('n')) ).' '.date('Y');
            $this->load->view('view_print_report', $data);
        } else { 
            
            $tabel_header = $this->p->umur_header();
            $nama_variabel = 'data';
            $isi = 'var '.$nama_variabel.'='.$this->p->umur_isi($print_mode);
            $data['judul'] = 'REKAPITULASIREKAPITULASI JUMLAH PEGAWAI NEGERI SIPIL BERDASARKAN KELOMPOK UMUR'.br().'BULAN '.strtoupper( getBulan(date('n')) ).' '.date('Y');
          
            $data['additional_js'] = $this->_setJsPaging($isi, $nama_variabel, $tabel_header);
            
            
            $data['link_cetak'] = base_url().'index.php/rekap_jumlah_pns/umur/true/';
            $data['tampilkan_menu'] = true;

        $this->load->view('v_rekap',$data);
        }
    }
    
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */